<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" href="${staticResources}/css/personalcenter.css" rel="stylesheet" />
<title>conbuyer</title>
</head>
<body onload="iframeResizePipe()">

<iframe id="helpframe" src='' height='0' width='0' frameborder='0'></iframe>
<script type="text/javascript">
  function iframeResizePipe()
  {
     // What's the page height?
     var height = document.body.scrollHeight;

     // Going to 'pipe' the data to the parent through the helpframe..
     var pipe = document.getElementById('helpframe');

     // Cachebuster a precaution here to stop browser caching interfering
     pipe.src = '${contextPath}/framehelper.html?height='+height+'&cacheb='+Math.random();
  }
</script>

<div class="con">
  <div class="jywc">
    <div class="grey2" style=" font-weight:600">已完成的交易(作为买家)</div>
    
    <c:forEach var="trans" items="${page.records}">
    <c:set var="bookitem" value="${trans.book }" />
    <c:set var="counterpart" value="${trans.seller }" />
    <div class="lists">
      <div class="list">
	   <c:choose>
	    <c:when test="${empty bookitem.front_end_picpath }">
	      <img src="${staticResources}/image/bepics_none.jpg" style="max-width:73px;max-height:86px" alt="">
	    </c:when>
	    <c:otherwise>
	    <img src="${userContents}/bepics/${bookitem.front_end_picpath}" style="max-width:73px;max-height:86px" alt="">
	    </c:otherwise>
	   </c:choose>
        <a target="_parent" href="${contextPath }/Transactions/ShowTransaction?tsid=${trans.tsID }">书名：${bookitem.name}</a><big>价格：</big><b>￥${bookitem.price}</b><br>
        <small>新旧程度：${bookitem.condition}</small>&nbsp;<small>笔记：${bookitem.hasNote}</small>
      </div>
      <div>
        <div class="shopper">
          <small>交易对象：</small><small><a href="#">${counterpart.nickName}</a></small><br>
          <small>信誉度：${counterpart.creditPoint}</small>
        </div>
        <div class="botton">
        </div>
      </div>
    </div>
    </c:forEach>
    
  </div>
  
  <div id="page">
    <ul>  
    
      <c:choose>
      <c:when test = "${page.hasPrevious}">
        <li><a href="?curPage=1&pageSize=${page.pageSize}">首页</a></li>
        <li><a href="?keyword=$curPage=${page.prePage}&pageSize=${page.pageSize}">上一页</a></li>
      </c:when>
      <c:otherwise>
        <li class = "currentpage">已到首页</li>
      </c:otherwise>
      </c:choose>
      <c:if test="${page.currentPage-3 gt 0}">
        <li><a href = "?curPage=${page.currentPage-3}&pageSize=${page.pageSize}">${page.currentPage-3}</a></li>
      </c:if>
      <c:if test="${page.currentPage-2 gt 0}">
        <li><a href = "?curPage=${page.currentPage-2}&pageSize=${page.pageSize}">${page.currentPage-2}</a></li>
      </c:if>
      <c:if test="${page.currentPage-1 gt 0}">
        <li><a href = "?curPage=${page.currentPage-1}&pageSize=${page.pageSize}">${page.currentPage-1}</a></li>
      </c:if>
      
      <li class = "currentpage"><b>${page.currentPage}</b></li>
  
      <c:if test="${page.maxPage - page.currentPage -0 gt 0}">
        <li><a href = "?curPage=${page.currentPage+1}&pageSize=${page.pageSize}">${page.currentPage+1}</a></li>
      </c:if>
      <c:if test="${page.maxPage - page.currentPage -1 gt 0}">
        <li><a href = "?curPage=${page.currentPage+2}&pageSize=${page.pageSize}">${page.currentPage+2}</a></li>
      </c:if>
      <c:if test="${page.maxPage - page.currentPage -2 gt 0}">
        <li><a href = "?curPage=${page.currentPage+3}&pageSize=${page.pageSize}">${page.currentPage+3}</a></li>
      </c:if>
      <c:choose>
      <c:when test = "${page.hasNext}">
        <li><a href="?curPage=${page.nextPage}&pageSize=${page.pageSize}">下一页</a></li>
        <li><a href="?curPage=${page.maxPage}&pageSize=${page.pageSize}">末页</a></li>
      </c:when>
      <c:otherwise>
        <li class = "currentpage">已到末页</li>
      </c:otherwise>
      </c:choose>
    
    </ul>
  </div>
  
</div>

</body>
</html>